package com.web.xlp.config;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118689516";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC2Jzoq4NEYul9OEFMryb8zA3KCZGRGsIeOvhT/VlhJ+LWhsLFWuoUCSP2FFFvgKTRe03Z/jTmMfsQzSQYYmuI+ZDZATBAMkUWQPUtqEwIf6y8wDI/vUkMoi9TiGmUhZYlxFKz3YZpIlq2ldpwVfn+0bAbLrma6OeRxZ7YVAC753bjMoGVbGSDnst3y8RsEkF4AkQfE8cdt4FOeFO9UtbfZ+rC8wTa4L686j1tha5I5aBznxHizpViH3oH+TjjUYy+h49D2weaE1Rw7LkNmM10Z5uOrEX8OOHpT9suA4VMYq9LYVYE+U/F0pv+wSfKhIIEKr1TbVGzvriaypb3AG0GPAgMBAAECggEAOvnacHWX3bzCDMFmXGAWwsqT8bnVabnQOhw7KiznqxOWo0JVOLJtTD8brlHYKWzN4wHudP/hqSaGGeDD04WaSP8jPZAjBh6m+juORkrfPjxka9c1ZxQoYGFdzNMk+Top1O4PzozQaj42/MK5aJArgtwTGzFdW2BRIZKltoj3rLhcOVY8YCfdPvJlSlNXKYCWqOwGrVTM/OdkXoRRTJ5vQYaTbQiEDd9yy7cxz9dih7uXM1h1CNc0pXZj2w1Q7bpOLD/JU7448XJBlLdF4dBcp0YhEaVvIZoaKx8FEBrSVN0PYaoRYBRIWibcHKq7pDo+DbWCQb83RhZgaTu2RMABmQKBgQDbo7GmNoE9kHLQkCxfc/AODQ6uNXlU5XdvV7UGmP3HncUWTucFy5cAkmQMl79HLQK40OAJKSAFAHLMvhFtuh4aWu3mA97iDvOpcGS/fuZ0PWrA+HezC9EkqNjelM6LkqEhDU2BPXLojDVjdcOyxpYD35lkLR38axIqQEljfEkaRQKBgQDUTt7TJDRQRmBGLXJ4Tm4xmjjw9J1lyLjK6oSi2wR3T8Sqovxbb3SpQxRauzqwFqlgSjIE2YeEJDmD45pa44Frb7D/WxUmXbyjiKBX6is7RGywSoyQjeeMbV4hoZNStI7xwEzjhFoM2Q8NBt2LqyDV2BkjQKK+ZEe+odJWwrazwwKBgQCmJC7vUe91SFzxUv2dvq9pkYr3UE/VXjZ4LNosgXIGm1tIQqsSgSxaLGIt/GOeTXfvoWC2zTsBTZOJOIUqgUzgFsQ559ejHDhIhVJQYIemigbEra6t61Rq7KYPyHRss5/axptIFdlj+xsvfxdnljxH9c2sL0ytcbit6S8aaBtMGQKBgDPf1YgHh5S5rVpYTmjg2QHbqeAOFMtC4QwLgz77frrcTbRXwItiz0FwN2/34V4XG2mAl3oh4H/EDh2Qpi1g+0VR9BBgo+lM7AOVJYB1ofyIOnpUrMXBNntUWbSj8wg5P9gH4YGR3CLZgljvfYBb3tkBRRsc9ubIP9NvXKKATv3bAoGAOkUlEhRfFzsyuQ//J0BnON7yhXaWvAfilO0LskS+VRMXydX/rUuKRUY0sCosx3naMx/KRZncsimvfW2KpIK8YIEfAOiyUo0ujZva3jT/+FTp+wAQ+30WCitzeQwj3PDfywsnak2oG9PakPkkIVnncb4U374nXwQJSmDjukNwAZ0=";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtic6KuDRGLpfThBTK8m/MwNygmRkRrCHjr4U/1ZYSfi1obCxVrqFAkj9hRRb4Ck0XtN2f405jH7EM0kGGJriPmQ2QEwQDJFFkD1LahMCH+svMAyP71JDKIvU4hplIWWJcRSs92GaSJatpXacFX5/tGwGy65mujnkcWe2FQAu+d24zKBlWxkg57Ld8vEbBJBeAJEHxPHHbeBTnhTvVLW32fqwvME2uC+vOo9bYWuSOWgc58R4s6VYh96B/k441GMvoePQ9sHmhNUcOy5DZjNdGebjqxF/Djh6U/bLgOFTGKvS2FWBPlPxdKb/sEnyoSCBCq9U21Rs764msqW9wBtBjwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/jsp/hs/personal.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";


	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }


    public static void main(String[] args) {
        Date vNow = new Date();
        String sNow = "";

        sNow += new String(String.valueOf(vNow.getMonth() + 1));
        sNow += new String(String.valueOf(vNow.getDate()));
        sNow += new String(String.valueOf(vNow.getHours()));
        sNow += new String(String.valueOf(vNow.getMinutes()));
        sNow += new String(String.valueOf(vNow.getSeconds()));

        System.out.println(sNow);
    }
}

